package com.heima.exam.p6;

import java.io.File;

public class Count {
    public static void main(String[] args) {
        File f = new File("src/com/heima/exam/p6/c72acfff06644b81a6f7340de641370e.jpg");
        File f1 = new File("src/com/heima/exam/p6");
        System.out.println(countIts(f));
        System.out.println(countIts(f1));
    }

    static int countIts(File f) {
        if (f.isFile()) {
            return (int) f.length();
        } else {
            int count = 0;
            File[] files = f.listFiles();
            for (File file : files) {
                count += countIts(file);
            }
            return count;
        }
    }
}
